/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bean;

import biz.classbiz;
import entityBean.ClassFacade;
import entity.Class;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

/**
 *
 * @author ADMIN
 */
@ManagedBean
@RequestScoped
public class ClassBean {

    @EJB
    private ClassFacade classFacade;
    private Class c = new Class();
    classbiz classbiz = new classbiz();
    List<Class> list = new ArrayList<Class>();

    public List<Class> getList() {
        return list;
    }

    public void setList(List<Class> list) {
        this.list = list;
    }

    /** Creates a new instance of ClassBean */
    public ClassBean() {
        list = classbiz.listClassz();
    }

    public String insert() {
        classFacade.create(c);
        list = classbiz.listClassz();
        return "listclass";
    }

    public String delete(Class c) {
        classFacade.remove(c);
        list = classbiz.listClassz();
        return "listclass";
    }

    public Class getC() {
        return c;
    }

    public void setC(Class c) {
        this.c = c;
    }
}
